package com.oocl.aeat.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oocl.aeat.dto.JsonResult;
import com.oocl.aeat.pojo.Verify;
import com.oocl.aeat.service.VerifyService;
import com.oocl.aeat.service.factory.VerifyServiceFactory;
import com.oocl.aeat.util.Const;
import com.oocl.aeat.util.JsonUtil;

@WebServlet("/sec/muserlist")
public class MUserListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private VerifyService verifyService;
    public MUserListServlet() {
    	verifyService = VerifyServiceFactory.getInstance();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		PrintWriter out = response.getWriter();
		String state = request.getParameter("state");
		List<Verify> vs = null;
		if(state!=null){
			vs = verifyService.queryAllVerify(Integer.parseInt(state));
		}else{
			vs = verifyService.queryAllVerify(0);
		}
		JsonResult result = new JsonResult(Const.JSON_SUCCESS, "success", vs);
		out.write(JsonUtil.getJsonFromObject(result));
		out.flush();
	}

}
